package com.yc.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yc.entity.AttendanceSheet;
import com.yc.mapper.AttendanceSheetMapper;
import com.yc.service.IAttendanceSheetService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author mqm
 * @since 2023-07-27
 */
@Service
public class AttendanceSheetServiceImpl extends ServiceImpl<AttendanceSheetMapper, AttendanceSheet> implements IAttendanceSheetService {

    @Resource
    private AttendanceSheetMapper attendanceSheetMapper;

    public List<Map<String, Object>> queryStuAttendanceInfo(String stuid) {
        List<Map<String, Object>> list = attendanceSheetMapper.queryStuAttendanceInfo(stuid);
        return list;
    }

    public void insertStuAttendanceInfo(String stuid, String description,
                                        String coursename, String time,
                                        int Attid, String imagePath, int changeStatus) {
        int teacherId = attendanceSheetMapper.queryTeacherId(Attid);
        attendanceSheetMapper.insertStuAttendanceInfo(stuid, time, teacherId, changeStatus, Attid, coursename, description, imagePath);
    }

    public List<Map<String, Object>> queryStuAttendanceInfoByTea(String username) {
        List<Map<String, Object>> list = attendanceSheetMapper.queryStuAttendanceInfoByTea(username);
        return list;
    }

    public Map<String, Object> queryimagePath(int id) {
        Map<String, Object> map = attendanceSheetMapper.queryimagePath(id);
        return map;
    }

    public void updateIsread(int id) {
        attendanceSheetMapper.updateIsread(id);
    }

    public void updateStatus(String stuid, int Attid, int status) {
        attendanceSheetMapper.updatestatus(stuid, Attid, status);
    }

    public void updateAttidStatus(String stuid, int Attid) {
        attendanceSheetMapper.updateAttidStatus(stuid, Attid);
    }

    public void updateAttidStatus2(String stuid, int Attid, String teacherReply) {
        attendanceSheetMapper.updateAttidStatus2(stuid, Attid, teacherReply);
    }

    public Map<String, Object> queryAttendenceImagePath(int id) {
        Map<String, Object> map = attendanceSheetMapper.queryAttendenceImagePath(id);
        return map;
    }
}
